package com.lebang.service.cences;

import com.lebang.domain.CencesBusMember;
import com.lebang.mapper.ActiveMemberMapper;
import com.lebang.mapper.LbbMemberMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

/**
 * @Author ljx
 * @Date 2020-11-27
 */
@Service
public class CencesHundredPointService {
    @Autowired
    private ActiveMemberMapper activeMemberMapper;
    @Autowired
    private LbbMemberMapper lbbMemberMapper;

    /**
     * 渠道活跃用户
     * @param end
     * @return
     */
    public List<CencesBusMember> activeMember(LocalDateTime end) {
        LocalDateTime star = end.minusDays(1);
        return activeMemberMapper.countByTime(star, end);
    }

    /**
     * 渠道
     * @return
     */
    public List<String> appStoreList(){
        return lbbMemberMapper.selectBrand();
    }

    public List<CencesBusMember> activeMemberList(LocalDateTime end) {
        LocalDateTime star = end.minusDays(1);
        return activeMemberMapper.activeCountByTime(star, end);
    }
}
